<script setup lang="ts">
import Menu from '../components/Menu.vue';
import { Expand , Fold} from '@element-plus/icons-vue'
import { ref,computed } from 'vue'

const collapsed = ref<boolean>(false)
// 定义侧边栏宽度
const autowidth = computed(() => {
    if (collapsed.value) {
        return "64px"
    }else {
        return "200px"
    }
})
</script>

<template>
  <main>
    <div class="common-layout">
      <el-container>
        <el-aside :style="'width:' + autowidth">
          <Menu :collapsed="collapsed"></Menu>
        </el-aside>
        <el-container>
          <el-header>
            <el-icon style="font-size: 30px;" @click="() => {collapsed = !collapsed}">
              <component :is="collapsed ? Expand:Fold"></component>
            </el-icon>
            Header</el-header>
          <el-main>
            <router-view></router-view>



          </el-main>
        </el-container>
      </el-container>
    </div>
  </main>
</template>

<style scoped >
.common-layout {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.el-container {
    height: 100%;
}

.el-header,
.el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: left;
    line-height: 80px;
}

.el-aside {
    /* background-color: @menuBg; */
    background-color: rgb(50,65,87);
    color: #333;
    text-align: center;
    /* line-height: 200px; */
    overflow: hidden;
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: left;
    /* line-height: 160px; */
}
</style>